#define _CRT_SECURE_NO_WARNINGS 1

#include"Heap.h"

void test()
{
	HP hp;
	HeapInit(&hp);
	int a[] = { 27, 15, 19, 18, 28, 34, 65, 49, 25, 37 };
	for (int i = 0; i < sizeof(a) / sizeof(int); ++i)
	{
		HeapPush(&hp, a[i]);
	}
	HeapPrint(&hp);

	HeapPush(&hp, 10);
	HeapPrint(&hp);

	HeapPop(&hp);
	HeapPrint(&hp);

	HeapPop(&hp);
	HeapPrint(&hp);

	HeapSort(hp.a, hp.size);
	HeapPrint(&hp);

	HeapDestroy(&hp);

}
//void TestTopk()
//{
//	int n = 10000;
//	int* a = (int*)malloc(sizeof(int) * n);
//	assert(a);
//	srand((unsigned int)time(NULL));
//	for (int i = 0; i < n; ++i)
//	{
//		a[i] = rand() % 100 + 10;
//	}
//	a[5] = 1;
//	a[1231] = 2;
//	a[531] = 3;
//	a[5121] = 4;
//	a[120] = 5;
//	a[99] = 6;
//	a[0] = 7;
//	a[76] = 8;
//	a[423] = 9;
//	a[3144] = 10;
//	PrintTopK(a, n, 10);
//}


int main()
{
	test();
	//TestTopk();
	return 0;
}